package cn.thornbird.orgsync.model.feishu;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DepartmentList extends Response {

    @JsonProperty("data")
    private PageableData<Department> data;


    @Data
    public static class Department {

        @JsonProperty("department_id")
        private String departmentId;

        @JsonProperty("open_department_id")
        private String openDepartmentId;

        @JsonProperty("name")
        private String name;

        @JsonProperty("i18n_name")
        private DepartmentI18nName i18nName;

        @JsonProperty("parent_department_id")
        private String parentDepartmentId;

        @JsonProperty("leader_user_id")
        private String leaderUserId;

        @JsonProperty("chat_id")
        private String chatId;

        @JsonProperty("order")
        private String order;

        @JsonProperty("unit_ids")
        private List<String> unitIds;

        @JsonProperty("member_count")
        private Integer memberCount;

        @JsonProperty("status")
        private DepartmentStatus status;

        @JsonProperty("leaders")
        private List<DepartmentLeader> leaders;

        /**
         * 部门群的人员类型限制: 1-正式员工, 2-实习生, 3-外包, 4-劳务, 5-顾问
         */
        @JsonProperty("groupChatEmployeeTypes")
        private List<Integer> group_chat_employee_types;

        @JsonProperty("department_hrbps")
        private List<String> departmentHrbps;

        @JsonProperty("primary_member_count")
        private Integer primaryMemberCount;

    }


    @Data
    public static class DepartmentDetail {

        @JsonProperty("department_id")
        private String departmentId;

        @JsonProperty("department_name")
        private DepartmentPathName departmentName;

        @JsonProperty("department_path")
        private DepartmentPath departmentPath;

    }


    @Data
    public static class DepartmentPath {

        @JsonProperty("department_ids")
        private List<String> departmentIds;

        @JsonProperty("department_path_name")
        private DepartmentPathName departmentPathName;

    }


    @Data
    public static class DepartmentPathName {

        @JsonProperty("name")
        private String name;

        @JsonProperty("i18n_name")
        private DepartmentI18nName i18nName;

    }


    @Data
    public static class DepartmentI18nName {

        @JsonProperty("zh_cn")
        private String zhCn;

        @JsonProperty("en_us")
        private String enUs;

        @JsonProperty("ja_jp")
        private String jaJp;

    }


    @Data
    public static class DepartmentStatus {

        @JsonProperty("is_deleted")
        private Boolean isDeleted;

    }


    @Data
    public static class DepartmentLeader {

        /**
         * 负责人类型: 1-主负责人, 2-副负责人
         */
        @JsonProperty("leaderType")
        private Integer leaderType;

        @JsonProperty("leaderID")
        private String leaderId;

    }

}
